home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qmessagebox.h.z / qmessagebox.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  4.2 KB  |  148 lines

  1. /****************************************************************************
  2. ** $Id: qmessagebox.h,v 2.27 1998/07/03 00:09:29 hanord Exp $
  3. **
  4. ** Definition of QMessageBox class
  5. **
  6. ** Created : 950503
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QMESSAGEBOX_H
  25. #define QMESSAGEBOX_H
  26.  
  27. #ifndef QT_H
  28. #include "qdialog.h"
  29. #endif // QT_H
  30.  
  31. class  QLabel;
  32. class  QPushButton;
  33. struct QMBData;
  34.  
  35.  
  36. class QMessageBox : public QDialog
  37. {
  38.     Q_OBJECT
  39. public:
  40.     enum Icon { NoIcon = 0, Information = 1, Warning = 2, Critical = 3 };
  41.  
  42.     QMessageBox( QWidget *parent=0, const char *name=0 );
  43.     QMessageBox( const char *caption, const char *text, Icon icon,
  44.          int button0, int button1, int button2,
  45.          QWidget *parent=0, const char *name=0, bool modal=TRUE,
  46.          WFlags f=0 );
  47.    ~QMessageBox();
  48.  
  49.     enum { Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5, Retry = 6,
  50.        Ignore = 7, ButtonMask = 0x07,
  51.        Default = 0x100, Escape = 0x200, FlagMask = 0x300 };
  52.  
  53.     static int information( QWidget *parent, const char *caption,
  54.                 const char *text,
  55.                 int button0, int button1=0, int button2=0 );
  56.     static int information( QWidget *parent, const char *caption,
  57.                 const char *text,
  58.                 const char *button0Text = "OK",
  59.                 const char *button1Text = 0, 
  60.                 const char *button2Text = 0,
  61.                 int defaultButtonNumber = 0,
  62.                 int escapeButtonNumber = -1 );
  63.  
  64.     static int warning( QWidget *parent, const char *caption,
  65.             const char *text,
  66.             int button0, int button1, int button2=0 );
  67.     static int warning( QWidget *parent, const char *caption,
  68.             const char *text,
  69.             const char *button0Text = "OK",
  70.             const char *button1Text = 0, 
  71.             const char *button2Text = 0,
  72.             int defaultButtonNumber = 0,
  73.             int escapeButtonNumber = -1 );
  74.  
  75.     static int critical( QWidget *parent, const char *caption,
  76.              const char *text,
  77.              int button0, int button1, int button2=0 );
  78.     static int critical( QWidget *parent, const char *caption,
  79.              const char *text,
  80.              const char *button0Text = "OK",
  81.              const char *button1Text = 0, 
  82.              const char *button2Text = 0,
  83.              int defaultButtonNumber = 0,
  84.              int escapeButtonNumber = -1 );
  85.     
  86.     static void about( QWidget *parent, const char *caption,
  87.                const char *text );
  88.  
  89.     static void aboutQt( QWidget *parent, const char *caption=0 );
  90.  
  91. #if 1 /* OBSOLETE */
  92.     static int message( const char *caption,
  93.             const char *text,  const char *buttonText=0,
  94.             QWidget *parent=0, const char *name=0 );
  95.  
  96.     static bool query( const char *caption,
  97.                const char *text,  const char *yesButtonText=0,
  98.                const char *noButtonText=0,
  99.                QWidget *parent=0, const char *name=0 );
  100. #endif
  101.  
  102.     const char *text() const;
  103.     void    setText( const char * );
  104.  
  105.     Icon    icon() const;
  106.     void    setIcon( Icon );
  107.  
  108.     const QPixmap *iconPixmap() const;
  109.     void    setIconPixmap( const QPixmap & );
  110.  
  111. #if 1 /* OBSOLETE */
  112.     const char *buttonText() const;
  113.     void    setButtonText( const char * );
  114. #endif
  115.  
  116.     const char *buttonText( int button ) const;
  117.     void    setButtonText( int button, const char * );
  118.  
  119.     void    adjustSize();
  120.  
  121.     void    setStyle( GUIStyle );
  122.  
  123.     static QPixmap standardIcon( Icon icon, GUIStyle style );
  124.  
  125. protected:
  126.     void    resizeEvent( QResizeEvent * );
  127.     void    keyPressEvent( QKeyEvent * );
  128.  
  129. private slots:
  130.     void    buttonClicked();
  131.  
  132. private:
  133.     void    init( int, int, int );
  134.     int        indexOf( int ) const;
  135.     void    resizeButtons();
  136.     QLabel     *label;
  137.     QMBData    *mbd;
  138.     void       *reserved1;
  139.     void       *reserved2;
  140.  
  141. private:    // Disabled copy constructor and operator=
  142.     QMessageBox( const QMessageBox & );
  143.     QMessageBox &operator=( const QMessageBox & );
  144. };
  145.  
  146.  
  147. #endif // QMESSAGEBOX_H
  148.